<template>
	<view>
		<myshop :nonotice="arr" @fatherMethod="fatherMethod"></myshop>
		<view class="listitem" v-for="(item,index) in arr1" v-show="show == 0" @click="list(index)">
			<view>
				<view>
					<view style="font-weight: 900;color: #fc0916;">￥{{item.money}}</view>
					<view>
						<u-button type="success" size="mini" class="btn">{{item.text}}</u-button>
					</view>
				</view>
				<view>
					<view>{{item.time}}</view>
					<view>余额：<text style="display: inline-block; width: 60rpx;">{{item.money}}</text></view>
				</view>
			</view>
		</view>
		<view class="listitem" v-for="(item,index) in arr2" v-show="show == 1" @click="list1(index)">
			<view>
				<view>
					<view style="font-weight: 900;color: #fc0916;">￥{{item.money}}</view>
					<view>
						<u-button type="warning" size="mini" class="btn">{{item.text}}</u-button>
					</view>
				</view>
				<view>
					<view>{{item.time}}</view>
					<view>余额：<text style="display: inline-block; width: 60rpx;">{{item.money}}</text></view>
				</view>
			</view>
		</view>
		<view class="listitem" v-for="(item,index) in arr3" v-show="show == 2" @click="list2(index)">
			<view>
				<view>
					<view style="font-weight: 900;color: #fc0916;">￥{{item.money}}</view>
					<view>
						<u-button size="mini" class="btn">{{item.text}}</u-button>
					</view>
				</view>
				<view>
					<view>{{item.time}}</view>
					<view>余额：<text style="display: inline-block; width: 60rpx;">{{item.money}}</text></view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import myshop from '../../components/myshop/myshop.vue'
	export default {
		components: {
			myshop
		},
		data() {
			return {
				show: 0,
				arr: ['已发', '待发', '未发'],
				arr1: [{
						// name:"充值",
						time: "4月1日9:35",
						consume: '+98',
						money: "99.38",
						text: '已发'
					},
					{
						// name:"消费",
						time: "4月1日9:35",
						consume: '-52',
						money: "1.38",
						text: '已发'
					},
					{
						// name:"积分",
						time: "4月1日9:35",
						consume: '+22',
						money: "22",
						text: '已发'
					},
				],
				arr2: [{
						// name:"充值",
						time: "4月1日9:35",
						consume: '+98',
						money: "99.38",
						text: '待发'
					},
					{
						// name:"消费",
						time: "4月1日9:35",
						consume: '-52',
						money: "1.38",
						text: '待发'
					},
					{
						// name:"积分",
						time: "4月1日9:35",
						consume: '+22',
						money: "22",
						text: '待发'
					},
				],
				arr3: [{
						// name:"充值",
						time: "4月1日9:35",
						consume: '+98',
						money: "99.38",
						text: '未发'
					},
					{
						// name:"消费",
						time: "4月1日9:35",
						consume: '-52',
						money: "1.38",
						text: '未发'
					},
					{
						// name:"积分",
						time: "4月1日9:35",
						consume: '+22',
						money: "22",
						text: '未发'
					},
				]
			}
		},
		methods: {
			fatherMethod(e) {
				console.log('测试');
				console.log(e)
				this.show = e
			},
			list(index) {
				uni.setStorage({
					key: 'storage_key',
					data: this.arr1[index],
					success: function() {
						uni.getStorage({
							key: 'storage_key',
							success: function(data) {
								console.log(data)
							}
						})
						uni.navigateTo({
							url: 'already'
						})
					},
				});
			},
			list1(index) {
				uni.setStorage({
					key: 'storage_key',
					data: this.arr2[index],
					success: function() {
						uni.getStorage({
							key: 'storage_key',
							success: function(data) {
								console.log(data)
							}
						})
						uni.navigateTo({
							url: 'await'
						})
					},
				});
			},
			list2(index) {
				uni.setStorage({
					key: 'storage_key',
					data: this.arr3[index],
					success: function() {
						uni.getStorage({
							key: 'storage_key',
							success: function(data) {
								console.log(data)
							}
						})
						uni.navigateTo({
							url: 'unfinished'
						})
					},
				});
			},

		}
	}
</script>

<style>
	page {
		background-color: #f5f5f5;
	}

	.listitem {
		background-color: #FFFFFF;
		margin-top: 4rpx;
	}

	.listitem>view {
		width: 90%;
		margin: 0 auto;
		height: 140rpx;
		font-size: 34rpx;
	}

	.listitem>view>view {
		display: flex;
		justify-content: space-between;
	}

	.listitem>view>view:nth-child(1) {
		padding-top: 20rpx;
	}

	.listitem>view>view:nth-child(2) {
		margin-top: 20rpx;
	}
</style>
